<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/commons/global.jsp" %>
<!DOCTYPE html>
<html>
<head>
    <%@ include file="/commons/basejs.jsp" %>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>消费记录管理</title>
</head>
<body>
<div class="easyui-layout" fit="true" >
        <table id="consume_datagrid" class="easyui-datagrid"
               data-options="
		   		url:'${root}/usercard/consumeDg.do',
		   		fit:true,
		   		rownumbers:true,
		   		fitColumns:true,
		   		toolbar:'#dg_tools',
		   		pagination:true,
		   		singleSelect:true">
            <thead>
                <th data-options="field:'id'">消费记录ID</th>
                <th data-options="field:'username',width:50">用户名</th>
                <th data-options="field:'product_name',width:80">消费产品</th>
                <th data-options="field:'seller_name',width:80">消费机构</th>
                <th data-options="field:'val',width:80">消费金额</th>
                <th data-options="field:'settlement_record_id',width:80">结算id</th>
                <th data-options="field:'settlement_type',width:80,formatter:
            function(value){if(value==0) return '不可结算';
                            if(value==1)return '可结算';
                            if(value==2) return '申请结算';
                            return '结算完成'}">结算状态</th>
                <th data-options="field:'create_time',width:80">时间</th>
            </thead>
        </table>
        <div id="dg_tools">
            <select id="settleStatus" style="width:80px;height:24px;position: relative;top: 3px;border-radius: 3px;" onchange="comboxchange()">
                <option value="">结算状态</option>
                <option value="0">不可结算</option>
                <option value="1">可结算</option>
                <option value="2">申请结算</option>
                <option value="3">申请完成</option>
            </select>
            <input class="easyui-searchbox" id="username" data-options="prompt:'搜索用户名',searcher:searchUser" style="width:150px;"/>
            <div id="date" style="display: inline">
                开始时间:<input id="begin"  class="Wdate"  onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" />
                结束时间:<input id="end"  class="Wdate"  onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" />
            </div>
            <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="selectConsume()">查询</a>
            <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-reload'" onclick="refconsumeDg()">重置</a>
        </div>
    <script type="text/javascript">
        //重置刷新
        function refconsumeDg(){
            $("#settleStatus").val("");
            $("#begin").val("");
            $("#end").val("");
            $("#username").val();
            var queryParams = {};
            var options = $("#consume_datagrid").datagrid('getPager').data("pagination").options;
            options.pageNumber = 1;
            $("#consume_datagrid").datagrid('options').queryParams = queryParams;
            $("#consume_datagrid").datagrid('reload');
        }
        //搜索用户
        function searchUser(){
            var queryParams = {};
            queryParams.username=$("#username").val();
            queryParams.type=$("#settleStatus").val();
            var options = $("#consume_datagrid").datagrid('getPager').data("pagination").options;
            options.pageNumber = 1;
            $("#consume_datagrid").datagrid('options').queryParams = queryParams;
            $("#consume_datagrid").datagrid('reload');
        }
        //下拉筛选结算状态
        function comboxchange(){
            var type = $("#settleStatus").val();
            var queryParams = {};
            queryParams.type=type;
            var options = $("#consume_datagrid").datagrid('getPager').data("pagination").options;
            options.pageNumber = 1;
            $("#consume_datagrid").datagrid('options').queryParams = queryParams;
            $("#consume_datagrid").datagrid('reload');
        }
        //搜索
        function selectConsume(){
            var begin = $("#begin").val();
            var end = $("#end").val();
            var type = $("#settleStatus").val();
            var queryParams = {};
            queryParams.type=type;
            queryParams.begin=begin;
            queryParams.end=end;
            var options = $("#consume_datagrid").datagrid('getPager').data("pagination").options;
            options.pageNumber = 1;
            $("#consume_datagrid").datagrid('options').queryParams = queryParams;
            $("#consume_datagrid").datagrid('reload');
        }
    </script>
</div>
</body>
</html>